import React from 'react';
import { View, StyleSheet, Text } from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
import Touchable from './Touchable';
import { Px2Dp, FontSize } from '../utils/Tool';

export const BlueGradientButton = ({
  text, children, style, textStyle, ...rest
}) => (
  <Touchable {...rest}>
    <LinearGradient start={{ x: 0, y: 0 }} end={{ x: 1, y: 0 }} colors={['#1b7ebf', '#2ba3f1']} style={[styles.button, style]}>
      <Text style={styles.text}>{text || children}</Text>
    </LinearGradient>
  </Touchable>
);

export const GreenGradientButton = ({
  text, children, style, textStyle, ...rest
}) => (
  <Touchable {...rest}>
    <LinearGradient start={{ x: 0, y: 0 }} end={{ x: 1, y: 0 }} colors={['#4a8c4c', '#5caf5e']} style={[styles.button, style]}>
      <Text style={styles.text}>{text || children}</Text>
    </LinearGradient>
  </Touchable>
);

const styles = StyleSheet.create({
  button: {
    borderRadius: Px2Dp(2),
    alignItems: 'center',
    justifyContent: 'center',
  },

  text: {
    color: '#FFFFFF',
    fontSize: FontSize(36),
    fontWeight: 'bold',
  },
});
